Fixing Letrec (reloaded)
نویسندگان
چکیده
The Revised6 Report on Scheme introduces three fundamental changes involving Scheme’s recursive variable binding constructs. First, it standardizes the sequential recursive binding construct, letrec*, which evaluates its initialization expressions in a strict leftto-right order. Second, it specifies that internal and library definitions have letrec* semantics. Third, it prohibits programs from invoking the continuation of a letrec or letrec* init expression more than once. The first two changes increase the incentive for handling letrec* efficiently, while the third change gives the compiler more options for transforming letrec and letrec* expressions. This paper extends an earlier effort of Waddell, Sarkar, and Dybvig to handle the Revised5 Report letrec and the (then nonstandard) letrec* efficiently. It presents more aggressive transformations for letrec and letrec* that take advantage of the new prohibition on invoking the continuations of initialization expressions multiple times. The implementation employs Tarjan’s algorithm for finding strongly connected components in a graph that encodes the dependencies among the bindings.
منابع مشابه
Fixing Letrec: A Faithful Yet Efficient Implementation of Scheme's Recursive Binding Construct
A Scheme letrec expression is easily converted into more primitive constructs via a straightforward transformation given in the Revised Report. This transformation, unfortunately, introduces assignments that can impede the generation of efficient code. This article presents a more judicious transformation that preserves the semantics of the revised report transformation and also detects invalid...
متن کاملModels of sharing graphs : a categorical semantics of let and letrec
It's coming again, the new collection that this site has. To complete your curiosity, we offer the favorite models of sharing graphs a categorical semantics of let and letrec book as the choice today. This is a book that will show you even new to old thing. Forget it; it will be right for you. Well, when you are really dying of models of sharing graphs a categorical semantics of let and letrec,...
متن کاملRobust and Effective Transformation of Letrec
A Scheme letrec expression is easily converted into more primitive constructs via a straightforward transformation given in the Revised Report. This transformation, unfortunately, introduces assignments that can impede the generation of efficient code. This paper presents a more judicious transformation that preserves the semantics of the revised report transformation and also detects invalid r...
متن کاملSimulation in the Call-by-Need Lambda-Calculus with Letrec, Case, Constructors, and Seq
This paper shows equivalence of several versions of applicative similarity and contextual approximation, and hence also of applicative bisimilarity and contextual equivalence, in LR, the deterministic call-by-need lambda calculus with letrec extended by data constructors, case-expressions and Haskell’s seq-operator. LR models an untyped version of the core language of Haskell. The use of bisimi...
متن کاملSimulation in the Call-by-Need Lambda-Calculus with letrec
This paper shows the equivalence of applicative similarity and contextual approximation, and hence also of bisimilarity and contextual equivalence, in the deterministic call-by-need lambda calculus with letrec. Bisimilarity simplifies equivalence proofs in the calculus and opens a way for more convenient correctness proofs for program transformations. Although this property may be a natural one...
متن کامل